﻿using MediatR;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace CSharp.Basic.Learn.MediatR
{
  /// <summary>
  /// 通知处理函数
  /// </summary>
  public class TestNotificationHanlder : INotificationHandler<TestNotification>
  {

    public Task Handle(TestNotification notification, CancellationToken cancellationToken)
    {
      //dosomthing
      Console.WriteLine("notification.Name:{0},notification.Description:{1}", notification.Name, notification.Description);
      return Task.CompletedTask;
    }
  }

  public class TestNotificationHanlder2 : INotificationHandler<TestNotification>
  {

    public Task Handle(TestNotification notification, CancellationToken cancellationToken)
    {
      //dosomthing
      Console.WriteLine("TestNotificationHanlder2 notification.Name:{0},notification.Description:{1}", notification.Name, notification.Description);
      return Task.CompletedTask;
    }
  }
}
